

# to load data
library(rio)


# to process data
library(tidyverse)
library(lubridate)
library(zoo)

# to make a nice y axis
library(scales)



# imported crude oil prices (in May 2021 USD)
oil_constant <- import("Imported_Crude_Oil_Prices.csv") %>%
  mutate(date = as.yearqtr(Quarter, format = "Q%q %Y"),
         year = year(date)) %>%
  filter(date<2021) %>%
  select(2,4) %>%
  rename(real_oil_price = `Real Values`)

ggplot(oil_constant, aes(x = date, y = real_oil_price)) + geom_line() + theme_minimal() + 
  scale_x_continuous(breaks = pretty_breaks()) + scale_y_continuous(breaks = pretty_breaks()) + 
  labs(x = "Year", y = "Oil Price, in 2021 USD") + theme(axis.text.x = element_text(size=12),
                                                         axis.text.y = element_text(size=12),
                                                         axis.title.x = element_text(size=12),
                                                         axis.title.y = element_text(size=12))


ggsave("figure2.pdf", height = 6, width=7)
